luci-mod-status: channel_analysis: detect 160 MHz capable AP
authorAleksander Jan Bajkowski <[email protected]>
Tue, 29 Oct 2024 23:12:52 +0000 (00:12 +0100)
committerAleksander Jan Bajkowski <[email protected]>
Thu, 7 Nov 2024 22:19:59 +0000 (23:19 +0100)
Implement a workaround to detect an 160MHz capable AP. It was introduced
in the mac80211 in 2016 with 802.11ac Wave 2. APs capable of 160 MHz are
detected by the shift of central frequencies. More detailed description
in the link [1]. Every AP I have seen presents support for 160 MHz in this way.

[1] https://github.com/torvalds/linux/commit/23665aaf9170ae6328cc4f68250c529a628af2ab
Fixes: #6262
Signed-off-by: Aleksander Jan Bajkowski <[email protected]>
modules/luci-mod-status/htdocs/luci-static/resources/view/status/channel_analysis.js

index fa6d26538c5403de51d1039b443cb2d9211df07b..feb27baef7bfd1876e20cb758eebe5a7f4a8d79e 100644 (file)
@@ -314,6 +314,22 @@ return view.extend({
                                        if (res.vht_operation.channel_width == 80) {
                                                chan_width = 8;
                                                res.channel_width = "80 MHz";
+
+                                               /* If needed, adjust based on the 802.11ac Wave 2 interop workaround. */
+                                               if (res.vht_operation.center_freq_2) {
+                                                       var diff = Math.abs(res.vht_operation.center_freq_2 -
+                                                                           res.vht_operation.center_freq_1);
+
+                                                       if (diff == 8) {
+                                                               chan_width = 16;
+                                                               res.channel_width = "160 MHz";
+                                                               center_channels.push(res.vht_operation.center_freq_2);
+                                                       } else if (diff > 8) {
+                                                               chan_width = 8;
+                                                               res.channel_width = "80+80 MHz";
+                                                               center_channels.push(res.vht_operation.center_freq_2);
+                                                       }
+                                               }
                                        } else if (res.vht_operation.channel_width == 8080) {
                                                res.channel_width = "80+80 MHz";
                                                chan_width = 8;